<script src="/theme/Admin/js/postManage/index.js"></script>
<?php echo $this -> Html -> css('Base/index'); ?>

<!-- BEGIN PAGE CONTENT-->
<div class="box">
	<div class="box-header">
		<h3 class="box-title">Products List</h3>
	</div><!-- /.box-header -->
	
	<!--thong bao-->
	<?php echo $this->Session->flash();?>
	<!--/thong bao-->
	<div class="box-body table-responsive">
		<!-- BEGIN TABLE PRODUCTS LIST-->
		<input type="hidden" value="1" name="postChecked" id="postChecked"/>
		<table id="example1" class="table table-bordered table-striped">
			<thead>
				<tr>
					<th>Tên SP</th>
					<th>Giá</th>
					<th>Năm sản xuất</th>
					<th>Nước sản xuất</th>
					<th>Thời gian sử dụng</th>
					<th>Tình trạng</th>
					<th>Đăng tin</th>
					<th>Hình ảnh</th>
					<th>Chỉnh sửa</th>
				</tr>
			</thead>
			<tbody>
				    <?php foreach($data as $item){?>
						<tr>
							<td><?php echo $item['Post']['title_vn'];?></td>
							<td><?php echo number_format($item['Post']['price']); echo $item['Post']['currency_type'] == CURRENCY_TYPE_VND? " VND":" USD"; ?></td>
							<td><?php echo $item['Post']['product_year'];?></td>
							<td><?php echo $item['Post']['product_country'];?></td>
							<td><?php echo $item['Post']['time_used'];echo $item['Post']['time_used_type'] == POST_TIME_TYPE_YEAR? " Năm":" Giờ"; ?></td>
							<td><?php echo $item['Post']['product_status']== POST_STATUS_NEW ? "Mới 100%":"Đã sử dụng";?></td>
							<td><?php echo $item['Post']['time_post']?></td>
							<td><img src="/<?php echo $item['Post']['image_icon'];?>" width="50px" height="50px"></td>
							<td>
								<a class="btn btn-danger" href="/admin/PostManage/uptop/<?php echo $item['Post']['id'] ?>/view">
									<span class="glyphicon glyphicon-arrow-up"></span>
								</a>
								<a class="btn btn-success" href="/admin/PostManage/edit/<?php echo $item['Post']['id'] ?>">
									<span class="glyphicon glyphicon-edit"></span>
								</a>
								<input type="hidden" class="postValue" value="<?php echo $item['Post']['id'] ?>"/>
								<a class="btn btn-warning delete_post" href="javascript:void(0)">
									<span class="glyphicon glyphicon-remove"></span>
								</a>
							</td>
						</tr>
					<?php }?>
			</tbody>
		</table>
		<!-- END TABLE PRODUCTS LIST-->
	</div><!-- /.box-body -->
	 <!-- BEGIN PAGINATION -->
    <?php 
    	if ($this -> Paginator -> counter('{:pages}') > 1){
    		echo $this->element('paginationAdmin', array('Paginator' => $this->Paginator));
		}
    ?>
 <!-- END PAGINATION -->
</div><!-- /.box -->
<!-- END PAGE CONTENT -->

<!-- page script -->
